<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" :inline="true">

      <el-form-item label="标题">
        <el-input
          v-model.trim="queryParams.noticeTitle"
          placeholder="请输入消息标题"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>

      <el-form-item label="消息状态" prop="isRead">
        <el-select
          v-model="queryParams.isRead"
          placeholder="点击进行选择"
          clearable
          size="small"
          class="width220"
          @change="handleQuery"
        >
          <el-option label="全部" value="" />
          <el-option label="未读" value="0" />
          <el-option label="已读" value="1" />
        </el-select>
      </el-form-item>

      <el-form-item label="时间选择" >
        <el-date-picker
          v-model="queryParams.time"
          size="small"
          value-format="yyyy-MM-dd"
          type="daterange"
          range-separator="-"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
          @change="handleQuery"
        ></el-date-picker>
      </el-form-item>

      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>

    </el-form>

    <div class="fl margin-bottom">
      <el-button type="primary" size="mini" icon="el-icon-plus" class="marginRight10 marginTop2" @click="handlePublicOpendcreate('dialogVisibleNewMessage')" v-hasPermi="['system:message:add']">创建消息</el-button>
      <el-button type="primary" size="mini" icon="el-icon-plus" class="marginRight10 marginTop2" @click="handlePublicOpendcreate('dialogVisibleNewNotice')" v-hasPermi="['system:notice:add']">创建公告</el-button>
<!--      <el-button type="primary" size="mini" class="marginRight10 marginTop2">标记所有消息为已读</el-button>-->
    </div>

    <el-table
      ref="myTable"
      :data="dataList"
      max-height="600"
      border
      stripe
      fit
      @selection-change="handleSelectionChange"
    >
      <el-table-column type="selection" width="55" align="center" fixed />
      <el-table-column v-if="colData[0].isTrue" fixed label="标题" prop="noticeTitle" :show-overflow-tooltip="true"/>
      <el-table-column v-if="colData[1].isTrue" fixed label="消息内容" prop="noticeContent" :show-overflow-tooltip="true"/>
      <el-table-column v-if="colData[2].isTrue" label="消息类型" prop="noticeType" :formatter="formatterNoticeType"   width="120" />
      <el-table-column v-if="colData[3].isTrue" label="消息状态" prop="isRead"  width="200" >
        <template slot-scope="scope">
          <el-tag
            :type="formatType(scope.row)"
            v-hasPermi="['system:message:add']"
            v-if="scope.row.createBy == username"
            disable-transitions>{{formatterNoticeState(scope.row)}}</el-tag>
          <el-tag
            :type="formatType2(scope.row)"
            v-if="scope.row.createBy != username"
            disable-transitions>{{formatterNoticeState2(scope.row)}}</el-tag>
        </template>
      </el-table-column>
      <el-table-column v-if="colData[4].isTrue" label="来自" prop="createBy" width="100" />
      <el-table-column v-if="colData[5].isTrue" label="时间" prop="createTime" width="100"/>
      <el-table-column v-if="colData[6].isTrue" label="操作" align="center"  fixed="right" width="auto">
        <template slot-scope="scope">
          <el-button size="mini" @click="handleView(scope.row.noticeId)" v-hasPermi="['system:notice:detail']">查看</el-button>
          <el-button v-show="scope.row.isRead === '0' && scope.row.noticeType === '2' && scope.row.createBy == username" size="mini" type="success" @click="handleUpdateView(scope.row.noticeId)" v-hasPermi="['system:notice:edit']">编辑</el-button>
          <el-button v-show="scope.row.isRead === '0' && scope.row.noticeType === '1' && scope.row.createBy == username" size="mini" type="success" @click="handleUpdateMessageView(scope.row.noticeId)" v-hasPermi="['system:notice:edit']">编辑</el-button>
          <el-button v-show="scope.row.isRead === '0' && scope.row.createBy == username" size="mini" type="danger" @click="handleDelateView(scope.row.noticeId)" v-hasPermi="['system:notice:remove']">撤回</el-button>
        </template>
      </el-table-column>
    </el-table>
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      :autoScroll="false"
      @pagination="getList"
    >
      <template v-slot:popover>
        <el-popover
          placement="top-end"
          width="260"
          trigger="hover"
        >
          <!--弹出的菜单内容-->
          <div class="selectMenu">
            <el-checkbox-group v-model="colOptions">
              <el-checkbox v-for="item in colSelect" :key="item" :label="item" class="displayBlock marginBottom10"/>
            </el-checkbox-group>
          </div>
          <el-button slot="reference" size="mini" class="selectBtn">
            <i class="el-icon-menu"></i><i class="el-icon-caret-bottom"></i>
          </el-button>
        </el-popover>
      </template>
    </pagination>

    <!-- 提示框-->
    <el-dialog
      title="消息详情"
      :visible.sync="dialogVisible"
      width="700px"
      append-to-body
    >
      <div>
        <ul class="ulView">
          <li><p>标题</p><p>{{dataInfo.noticeTitle}}</p></li>
          <li><p>消息内容</p><p>{{dataInfo.noticeContent}}</p></li>
          <li><p>消息类型</p><p>{{dataInfo.noticeType}}</p></li>
          <li><p>来自</p><p>{{dataInfo.createBy}}</p></li>
          <li><p>时间</p><p>{{dataInfo.updateTime}}</p></li>
        </ul>
      </div>
    </el-dialog>

    <!-- 创建公告 -->
    <el-dialog
      title="创建公告"
      :visible.sync="dialogVisibleNewNotice"
      width="600px"
      append-to-body
    >
      <div class="dialogView">
        <el-form :model="createNoticetForm" :rules="createNoticetRules" ref="createNoticeForm">
          <el-row :gutter="20">
            <el-col :span="24" class="form-wrap">
              <el-form-item label="标题" prop="noticeTitle" class="from-group">
                <el-input
                  v-model="createNoticetForm.noticeTitle"
                  placeholder="请输入公告标题"
                  clearable
                  @keyup.enter.native="handleQuery"
                />
              </el-form-item>

              <el-form-item label="内容" prop="noticeContent" class="from-group">
                <el-input
                  type="textarea"
                  v-model="createNoticetForm.noticeContent"
                  placeholder="请输入公告内容"
                  clearable
                  @keyup.enter.native="handleQuery"
                />
              </el-form-item>
            </el-col>
          </el-row>
          <div class="flexRowBetween">
            <el-button type="primary" style="flex: 1;" @click="noticeApplyTo">发送</el-button>
            <el-button style="flex: 1;" @click="publicHandleCancel('dialogVisibleNewNotice')">取消</el-button>
          </div>
        </el-form>
      </div>
    </el-dialog>
    <!-- 创建公告 end -->

    <!-- 更新公告 -->
    <el-dialog
      title="创建公告"
      :visible.sync="dialogVisibleUpdateNotice"
      width="600px"
      append-to-body
    >
      <div class="dialogView">
        <el-form :model="updateNoticetForm" :rules="updateNoticetRules" ref="createNoticeForm">
          <el-row :gutter="20">
            <el-col :span="24" class="form-wrap">
              <el-form-item label="标题" prop="noticeTitle" class="from-group">
                <el-input
                  v-model="updateNoticetForm.noticeTitle"
                  placeholder="请输入公告标题"
                  clearable
                  @keyup.enter.native="handleQuery"
                />
              </el-form-item>

              <el-form-item label="内容" prop="noticeContent" class="from-group">
                <el-input
                  type="textarea"
                  v-model="updateNoticetForm.noticeContent"
                  placeholder="请输入公告内容"
                  clearable
                  @keyup.enter.native="handleQuery"
                />
              </el-form-item>
            </el-col>
          </el-row>
          <div class="flexRowBetween">
            <el-button type="primary" style="flex: 1;" @click="noticeSever">保存</el-button>
            <el-button style="flex: 1;" @click="publicHandleCancel('dialogVisibleUpdateNotice')">取消</el-button>
          </div>
        </el-form>
      </div>
    </el-dialog>
    <!-- 更新公告 end -->

    <!-- 创建消息 -->
    <el-dialog
      title="创建消息"
      :visible.sync="dialogVisibleNewMessage"
      width="600px"
      append-to-body
    >
      <div class="dialogView">
        <el-form :model="createMessageForm" :rules="createMessageRules" ref="createMessageForm">
          <el-row :gutter="20">
            <el-col :span="24" class="form-wrap">
              <el-form-item label="联系人昵称" prop="informedPersonId" class="from-group">
                <el-select
                  v-model="createMessageForm.informedPersonId"
                  filterable
                  remote
                  reserve-keyword
                  placeholder="请输入联系人昵称"
                  :remote-method="remoteMethod"
                  :loading="loading" class="contact">
                  <el-option
                    v-for="item in options"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value">
                  </el-option>
                </el-select>
              </el-form-item>

              <el-form-item label="标题" prop="noticeTitle" class="from-group">
                <el-input
                  v-model="createMessageForm.noticeTitle"
                  placeholder="请输入消息标题"
                  clearable
                  @keyup.enter.native="handleQuery"
                />
              </el-form-item>

              <el-form-item label="内容" prop="noticeContent" class="from-group">
                <el-input
                  type="textarea"
                  v-model="createMessageForm.noticeContent"
                  placeholder="请输入公共内容"
                  clearable
                  @keyup.enter.native="handleQuery"
                />
              </el-form-item>
            </el-col>
          </el-row>
          <div class="flexRowBetween">
            <el-button type="primary" style="flex: 1;" @click="messageApplyTo">发送</el-button>
            <el-button style="flex: 1;" @click="publicHandleCancel('dialogVisibleNewMessage')">取消</el-button>
          </div>
        </el-form>
      </div>
    </el-dialog>
    <!-- 创建消息 end -->

    <!-- 更新消息 -->
    <el-dialog
      title="更新消息"
      :visible.sync="dialogVisibleUpdateMessage"
      width="600px"
      append-to-body
    >
      <div class="dialogView">
        <el-form :model="updateMessageForm" :rules="updateMessageRules" ref="createMessageForm">
          <el-row :gutter="20">
            <el-col :span="24" class="form-wrap">
              <el-form-item label="联系人昵称" prop="informedPersonId" class="from-group">
                <el-select
                  v-model="updateMessageForm.informedPersonId"
                  filterable
                  remote
                  reserve-keyword
                  placeholder="请输入联系人昵称"
                  :remote-method="remoteMethod"
                  :loading="loading" class="contact"
                   @change="lxrChange">
                  <el-option
                    v-for="item in options"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value">
                  </el-option>
                </el-select>
              </el-form-item>

              <el-form-item label="标题" prop="noticeTitle" class="from-group">
                <el-input
                  v-model="updateMessageForm.noticeTitle"
                  placeholder="请输入消息标题"
                  clearable
                  @keyup.enter.native="handleQuery"
                />
              </el-form-item>

              <el-form-item label="内容" prop="noticeContent" class="from-group">
                <el-input
                  type="textarea"
                  v-model="updateMessageForm.noticeContent"
                  placeholder="请输入公共内容"
                  clearable
                  @keyup.enter.native="handleQuery"
                />
              </el-form-item>
            </el-col>
          </el-row>
          <div class="flexRowBetween">
            <el-button type="primary" style="flex: 1;" @click="messageSever">保存</el-button>
            <el-button style="flex: 1;" @click="publicHandleCancel('dialogVisibleUpdateMessage')">取消</el-button>
          </div>
        </el-form>
      </div>
    </el-dialog>
    <!-- 更新消息 end -->
  </div>
</template>

<script>
import { listNotice, getNotice, readNotice, searchNoticeMaembenr, addNotice, addMessage, updateNotice, delNotice  } from "@/api/system/notice"
export default {
  name: "MessageList",
  data() {
    return {
      dialogVisible: false,  // 弹框： 查看
      dialogVisibleNewNotice: false, //创建新通知 弹窗
      dialogVisibleNewMessage: false, //创建新消息 弹窗
      dialogVisibleUpdateNotice: false, //更新通知 弹窗
      dialogVisibleUpdateMessage: false, //更新消息 弹窗
      dataList:[],
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 总条数
      total: 0,
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        isRead: '', // 状态
        noticeTitle: '', // 标题
        time: '',
        pageSize: 10,
        pageNum: 1
      },
      // 多选框 已选择 的内容，即表格中显示的列
      colOptions: ['标题', '消息内容', '消息类型', '消息状态', '来自', '时间', '操作'],
      // 多选框 可选择项
      colSelect: ['标题', '消息内容', '消息类型', '消息状态', '来自', '时间', '操作'],
      // isTrue属性存放列的状态
      colData: [
        { title: '标题', isTrue: true },
        { title: '消息内容', isTrue: true },
        { title: '消息类型', isTrue: true },
        { title: '消息状态', isTrue: true },
        { title: '来自', isTrue: true },
        { title: '时间', isTrue: true },
        { title: '操作', isTrue: true },
      ],
      // 创建公告表单 creatNotice
      createNoticetForm: {
          noticeTitle:'',
          noticeContent: '', // 内容
          noticeType:'2',
          isRead:'0',
      },
       createNoticetRules: {
           noticeTitle: [
              {required: true, trigger: "blur", message: "内容不能为空"},
              {min: 1, message: '请正确输入公告标题', trigger: 'blur'}
          ],
           noticeContent: [
              {required: true, trigger: "blur", message: "内容不能为空"},
              {min: 1, message: '请正确输入，文本内容', trigger: 'blur'}
          ]
      },
      // 更新公告表单
      updateNoticetForm: {
          noticeTitle:'',
          noticeContent: '', // 内容
          noticeType:'2',
          isRead:'0',
      },
      updateNoticetRules: {
          noticeTitle: [
              {required: true, trigger: "blur", message: "内容不能为空"},
              {min: 1, message: '请正确输入公告标题', trigger: 'blur'}
          ],
          noticeContent: [
              {required: true, trigger: "blur", message: "内容不能为空"},
              {min: 1, message: '请正确输入，文本内容', trigger: 'blur'}
          ]
      },
      // 创建消息表单 creatNotice
      createMessageForm: {
          informedPersonId: '',
          noticeTitle:'',
          noticeContent: '', // 内容
          noticeType:'1',
          isRead:'0',
      },
      createMessageRules: {
          informedPersonId: [
              {required: true, trigger: "change", message: "联系人不能为空"},
              { message: '请联系人', trigger: 'change'}
          ],
          noticeTitle: [
              {required: true, trigger: "blur", message: "内容不能为空"},
              {min: 1, message: '请正确输入公告标题', trigger: 'blur'}
          ],
          noticeContent: [
              {required: true, trigger: "blur", message: "内容不能为空"},
              { message: '请正确输入，文本内容', trigger: 'blur'}
          ]
      },
      // 更新消息表单
      updateMessageForm: {
          informedPersonId: '',
          noticeTitle:'',
          noticeContent: '', // 内容
          noticeType:'1',
          isRead:'0',
      },
        updateMessageRules: {
          informedPersonId: [
              {required: true, trigger: "change", message: "联系人不能为空"},
              { message: '请联系人', trigger: 'change'}
          ],
          noticeTitle: [
              {required: true, trigger: "blur", message: "内容不能为空"},
              {min: 1, message: '请正确输入公告标题', trigger: 'blur'}
          ],
          noticeContent: [
              {required: true, trigger: "blur", message: "内容不能为空"},
              { message: '请正确输入，文本内容', trigger: 'blur'}
          ]
      },
      options: [], // 搜索选择联系人
      value: [],
      list: [],
      contactLoading: false,
      states: [],
      dataInfo: {}, // 消息详情
      defaultSearchId:'', // 用户编辑消息时回显 接受人 如果不为空提交消息编辑时，传 defaultSearchId
      username : this.$store.getters.userInfo.userName
    };
  },
  beforeUpdate() {
    // 防止动态添加列时 表格乱
    this.$nextTick(() => {
      this.$refs.myTable.doLayout();
    });
  },
  watch: {
    colOptions(newVal, oldVal) {
      if (newVal) {    // 如果有值发生变化，即多选框的已选项变化
        let arr = this.colSelect.filter(i => newVal.indexOf(i) < 0) 	// 未选中
        this.colData.filter(i => {
          if (arr.indexOf(i.title) !== -1) {
            i.isTrue = false
          } else {
            i.isTrue = true
          }
        })
      }
    }
  },
  created() {
      if(this.$route.query && this.$route.query.status == 0){
        this.queryParams.isRead = 0
      }
    this.getList();
  },
  methods: {
      // 关闭窗口 公共方法
      publicHandleCancel(name) {
          this[name] = false;
      },
      // 关闭窗口 公共方法 end

      // 打开创建公告、创建通知公共方法
      handlePublicOpendcreate(name) {
          this[name] = true;
      },
      // 发送公告
      noticeApplyTo(){
          let self = this
          this.$refs.createNoticeForm.validate(valid => {
              if (valid) {
                  self.loading = true;
                  addNotice(self.createNoticetForm).then(res=>{
                      // 初始化公告表单数据
                      self.createNoticetForm = {
                          noticeTitle:'',
                          noticeContent: '', // 内容
                          noticeType:'2',
                          isRead:'0',
                      }
                      // 刷新列表 回到第一页
                      self.queryParams.pageNum = 1;
                      self.getList();
                      self.loading = false;
                      self.dialogVisibleNewNotice = false;
                      self.$message({
                          message: '发送成功!!',
                          type: 'success'
                      });
                  }).catch(()=>{
                      self.loading = false;
                  });
              }
          });
      },
      // 发送公告 end

      // 发送消息
      messageApplyTo(){
          let self = this;
          this.$refs.createMessageForm.validate(valid => {
              if (valid) {
                  self.loading = true;
                  addMessage(self.createMessageForm).then(res=>{
                      // 初始化消息表单数据
                      self.createMessageForm = {
                          informedPersonId: '',
                          noticeTitle:'',
                          noticeContent: '', // 内容
                          noticeType:'1',
                          isRead:'0',
                      }
                      // 刷新列表 回到第一页
                      self.queryParams.pageNum = 1;
                      self.getList();
                      self.loading = false;
                      self.dialogVisibleNewMessage = false;
                      self.$message({
                          message: '发送成功!!',
                          type: 'success'
                      });
                  }).catch(()=>{
                      self.loading = false;
                  });
              }
          });
      },
      // 发送消息 end

      // 搜索联系人
      remoteMethod(query) {
          let self = this;
          if (query !== '') {
              self.states =[];
              this.loading = true;
              searchNoticeMaembenr(decodeURI(query)).then(res=>{
                  self.loading = false;
                  self.states = res.rows;
                  self.list = self.states.map(item => {
                      return { value: `${item.user_id}`, label: `${item.nick_name}` };
                  });
                  self.options = self.list.filter(item => {
                      return item.label.indexOf(query) > -1;
                  });
              }).catch(()=>{
                  this.loading = false;
              });
          } else {
              this.options = [];
          }
      },
      // 搜索联系人 end
     lxrChange(){
         this.defaultSearchId = '';
     },
    /** 查询权限列表 */

    getList() {
      this.loading = true;
      // this.queryParams.informedPersonId = this.$store.getters.userInfo.userId; //  管理员不需要传informedPersonId
      this.queryParams.beginTime = this.queryParams.time && this.queryParams.time[0]?this.queryParams.time[0]+ ' 00:00:00':'';
      this.queryParams.endTime = this.queryParams.time && this.queryParams.time[1]?this.queryParams.time[1]+ ' 00:00:00':'';
      const targetParams = JSON.stringify(this.queryParams);
      const targetObj = JSON.parse(targetParams);
      delete targetObj.time;
      listNotice(targetObj).then(
        response => {
          this.dataList = response.rows;
          this.total = response.total;
          this.loading = false;
        }
      );
    },
    //表单格式化
    formatterNoticeType(row, column) {
        return row.noticeType =="2"? '公告':'个人消息';
    },
    formatType(row){
      if(row.createBy === this.username && row.isRead === '1'){
        return "warning";
      }
      if(row.createBy === this.username && row.isRead === '0'){
        return "primary";
      }
      if(row.uread > 0 && row.noticeType === '1'){
        return "success";
      }
      if(row.nread > 0 && row.noticeType === '2'){
        return "success";
      }
      return "danger";
    },
    formatType2(row){
      if(row.uread > 0 && row.noticeType === '1'){
        return "success";
      }
      if(row.nread > 0 && row.noticeType === '2'){
        return "success";
      }
      return "danger";
    },
    formatterNoticeState(row) {
       if(row.createBy === this.username && row.isRead === '1'){
         return "不可编辑";
       }
       if(row.createBy === this.username && row.isRead === '0'){
         return "可编辑";
       }
      return "不可编辑";
    },
    formatterNoticeState2(row) {
      if(row.uread > 0 && row.noticeType === '1'){
        return "已读";
      }
      if(row.nread > 0 && row.noticeType === '2'){
        return "已读";
      }
      return "未读";
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.roleId)
      this.single = selection.length != 1
      this.multiple = !selection.length
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.queryParams = {};
      this.handleQuery();
    },
      // 查看通知详情
    handleView(id) {
      let self = this;
      this.dialogVisible = true;
      this.getNoticeInfo(id)
      setTimeout(function(){
          // 更新列表
          self.getList();
      },800)
    },
      // 打开更新公告模板
     handleUpdateView(id){
         let self = this;
         this.dialogVisibleUpdateNotice = true;
         getNotice(id).then(
             response => {
                self.updateNoticetForm = {
                     noticeTitle:response.data.noticeTitle,
                     noticeContent: response.data.noticeContent, // 内容
                     noticeType: response.data.noticeType,
                     isRead:'0',
                     noticeId: response.data.noticeId
                 }
             }
         );

     },
      // 修改公告
    noticeSever(){
        const self = this;
        updateNotice(self.updateNoticetForm).then( response => {
            self.dialogVisibleUpdateNotice = false;
            self.getList();
            self.$message({
                message: '修改成功!!',
                type: 'success'
            });
        })
    },
      // 打开消息模板
     handleUpdateMessageView(id){
         let self = this;
         this.dialogVisibleUpdateMessage = true;
         getNotice(id).then(
             response => {
                 self.defaultSearchId = response.data.informedPersonId;
                 self.updateMessageForm = {
                     informedPersonId: response.data.informedPersonName,
                     noticeTitle:response.data.noticeTitle,
                     noticeContent: response.data.noticeContent, // 内容
                     noticeType: response.data.noticeType,
                     isRead:'0',
                     noticeId: response.data.noticeId
                 }
             }
         );
     },
      // 修改消息
      messageSever(){
          const self = this;
          let targetparams = JSON.stringify(self.updateMessageForm);
          let params = JSON.parse(targetparams);
          if(self.defaultSearchId && self.defaultSearchId !=''){
              params.informedPersonId = self.defaultSearchId;
          }
          updateNotice(params).then( response => {
              self.dialogVisibleUpdateMessage = false;
              self.getList();
              self.$message({
                  message: '修改成功!!',
                  type: 'success'
              });
          })
      },
     // 标记为已读
     readData(id){
        let params = {
            noticeId: id
        }
        readNotice(params).then( () => {});
     },

     // 获取消息详情
     getNoticeInfo(id){
        let self = this ;
         getNotice(id).then(
             response => {
               debugger
               self.dataInfo = response.data;
               if(  self.dataInfo.createBy != self.$store.getters.userInfo.userName){
                 // 标记为已读
                 self.readData(id);
                 self.getList();
               }
             }
         );
     },
      /** 删除按钮操作 */
      handleDelete(row) {
          const userIds = row.userId || this.ids;
          this.$confirm(
              '是否确认删除用户编号为"' + userIds + '"的数据项?',
              "警告",
              {
                  confirmButtonText: "确定",
                  cancelButtonText: "取消",
                  type: "warning",
              }
          )
              .then(function () {
                  return delUser(userIds);
              })
              .then(() => {
                  this.getList();
                  this.msgSuccess("删除成功");
              })
              .catch(function () {});
      },
      // 撤回消息
    handleDelateView(id){
        const self = this;
        this.$confirm(
            '是否确认撤回编号为"' + id + '"的数据项?',
            "警告",
            {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning",
            }
        ).then(function () {
           delNotice(id)
        }).then( () => {
            self.getList();
        }).catch(function () {});
    },
    handleUpdate(row) {
      // this.$router.push({ path: '/office/edit',query:{ officeId: row.officeId }});
    },
  }
};
</script>
<style lang="scss" scoped>
  .app-container{
    position: relative;
  }
  /*form 表单 样式设置 start*/
  ::v-deep .el-form-item{
    margin-bottom: 10px;
  }
  ::v-deep label[for='unifiedSocialCreditCode'],
  ::v-deep label[for='nameOfChargePerson'],
  ::v-deep label[for='certificateNoOfResponsity']{
    line-height: 20px;
  }
  ::v-deep .el-input--suffix .el-input__inner {
    padding-right: 10px;
  }
  ::v-deep .el-select .el-input--suffix .el-input__inner {
    padding-right: 30px;
  }
  ::v-deep .el-date-editor .el-range-input{
    width: 62%;
  }
  /*form 表单 样式设置 end*/

  .width220{
    width: 220px;
  }
  .failedContent{
    margin-top: 20px;
    padding: 20px;
    border: 1px dashed #ccc;
    p{
      line-height: 24px;
    }
  }

  .ulView{
    li{
      display: flex;
      border: 1px solid #dfe6ec;
      p{
        display: inline-block;
        padding: 10px 15px;
        line-height: 26px;
      }
      p:first-child{
        flex: 1;
        border-right: 1px solid #dfe6ec;
        font-weight: 500;
      }
      p:last-child{
        flex: 5;
      }

    }
    li + li{ border-top: none;}
  }
  .form-wrap{
    margin-bottom:40px;
  }
  .form-wrap .contact{
    width:100%;
  }
  .margin-bottom{
    margin-bottom:10px;
  }
  ::v-deep .el-dialog__body{
    padding-top:20px;
  }
</style>
